home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / JMaskedTextFieldBeanInfo.java < prev    next >
Text File  |  1998-10-25  |  5KB  |  126 lines

  1. /*
  2.  * @(#JMaskedTextFieldBeanInfo.java
  3.  *
  4.  * Copyright (c) 1998 Symantec Corporation. All Rights Reserved.
  5.  *
  6.  */
  7.  
  8. package com.symantec.itools.swing;
  9.  
  10. import java.beans.*;
  11. import java.util.ResourceBundle;
  12. import com.symantec.itools.swing.DesignTimeResourceBundle;
  13. import com.symantec.itools.vcafe.beans.PropertyDescriptorAttributes;
  14. import com.symantec.itools.vcafe.beans.PropertyHelpIDs;
  15.  
  16. //  08/19/98    LAB    Moved to GroupAWTAdditions folder.
  17.  
  18. /**
  19.  * BeanInfo for the JMaskedTextField component.
  20.  *
  21.  */
  22. public class JMaskedTextFieldBeanInfo  extends com.symantec.itools.beans.HelperBeanInfo {
  23.  
  24.     public JMaskedTextFieldBeanInfo()
  25.     {
  26.         setInheritSuperBeanInfo(true);
  27.  
  28.         ResourceBundle resources = ResourceBundle.getBundle("com.symantec.itools.swing.DesignTimeResourceBundle");
  29.         String folderName = resources.getString(DesignTimeResourceBundle.SWING_ADDITIONS_FOLDER_TOOLBAR_KEY);
  30.         setComponentLibraryFolder(folderName);
  31.         setToolbarFolder(folderName);
  32.         setWinHelpKey(m_WinHelpID);
  33.  
  34.     }
  35.  
  36.     protected Class getBeanClass()
  37.     {
  38.         return JMaskedTextField.class;
  39.     }
  40.  
  41.  
  42.     public PropertyDescriptor[] getPropertyDescriptors() {
  43.         ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.resources.PropBundle");
  44.         final Class beanClass = getBeanClass();
  45.         try {
  46.             PropertyDescriptor mask = new PropertyDescriptor("mask", beanClass);
  47.             mask.setDisplayName(prop.getString("mask"));
  48.             mask.setValue(PropertyDescriptorAttributes.WIN_HELP_ATTRIBUTE, new Integer(PropertyHelpIDs.JMASKEDTEXTFIELD_MASK_HELP_ID));
  49.  
  50.             PropertyDescriptor document = new PropertyDescriptor ("document", beanClass);
  51.             document.setHidden (true);
  52.  
  53.             PropertyDescriptor[] rv = {    mask, document };
  54.             return rv;
  55.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  56.     }
  57.  
  58.     /**
  59.      * Gets an image that may be used to visually represent this bean
  60.      * (in the toolbar, on a form, etc).
  61.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  62.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  63.      * @return an image for this bean, always color even if requested monochrome
  64.      * @see BeanInfo#ICON_MONO_16x16
  65.      * @see BeanInfo#ICON_COLOR_16x16
  66.      * @see BeanInfo#ICON_MONO_32x32
  67.      * @see BeanInfo#ICON_COLOR_32x32
  68.      */
  69.     public java.awt.Image getIcon(int iconKind) {
  70.     java.awt.Image img = null;
  71.     switch (iconKind) {
  72.         case BeanInfo.ICON_MONO_16x16:
  73.         case BeanInfo.ICON_COLOR_16x16:
  74.             img = loadImage("jmask16.gif");
  75.             break;
  76.         case BeanInfo.ICON_MONO_32x32:
  77.         case BeanInfo.ICON_COLOR_32x32:
  78.             img = loadImage("jmask32.gif");
  79.         }
  80.         return img;
  81.     }
  82.  
  83.     /**
  84.      * Gets an array of descriptions of the methods used for "connections" by
  85.      * Visual CafΘ's Interaction Wizard.
  86.      * Included in each method description is a CONNECTIONS ConnectionDescriptor.
  87.      * @return method descriptions for this bean
  88.      * @see symantec.itools.beans.ConnectionDescriptor#CONNECTIONS
  89.      */
  90.     /*public MethodDescriptor[] getMethodDescriptors() {
  91.         Class[] args = null;
  92.         ConnectionDescriptor connection;
  93.         java.util.Vector connections;
  94.         java.util.Vector md = new java.util.Vector();
  95.         ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
  96.         String s;
  97.         try {
  98.             MethodDescriptor getMask = new MethodDescriptor(beanClass.getMethod("getMask", args));
  99.             connections = new java.util.Vector();
  100.             connection = new ConnectionDescriptor("output", "String", "",
  101.                                                   "%name%.getMask()",
  102.                                                   conn.getString("getMask"));
  103.             connections.addElement(connection);
  104.             getMask.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  105.             md.addElement(getMask);
  106.         } catch (Exception e) { throw new Error("getMask:: " + e.toString()); }
  107.         try{
  108.             args = new Class[1];
  109.             args[0] = java.lang.String.class ;
  110.             MethodDescriptor setMask = new MethodDescriptor(beanClass.getMethod("setMask", args));
  111.             connections = new java.util.Vector();
  112.             connection = new ConnectionDescriptor("input", "String", "",
  113.                                                   "%name%.setMask(%arg%);",
  114.                                                   conn.getString("setMask"));
  115.             connections.addElement(connection);
  116.             setMask.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  117.             md.addElement(setMask);
  118.         } catch (Exception e) { throw new Error("setMask:: " + e.toString()); }
  119.         MethodDescriptor[] rv = new MethodDescriptor[md.size()];
  120.         md.copyInto(rv);
  121.         return rv;
  122.     }*/
  123.  
  124.     protected final static String m_WinHelpID = "0x600FB";
  125. }
  126.